/*
 * This file is part of aKoustiK.

 * aKoustiK is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * aKoustiK is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with aKoustiK.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef TRAY_H
#define TRAY_H

#include <KStatusNotifierItem>
#include <QtCore/QObject>

#include <ui/mainwindow.h>

/**
  Tray controller for aKoustiK. It incapsulates all work related to system tray.
  As of KDE 4.4 KStatusNotifierItem is used.
  */
class Tray : public QObject {
    Q_OBJECT
public:
    // constructors/destructors:
    Tray(QObject* parent);
    ~Tray();

private:

    // fields:
    /** KDE 4.4 way to show system tray icon. */
    KStatusNotifierItem *statusNotifier;
    /** Pointer to main window. May be 0 if no main window is shown. */
    MainWindow *mainWindow;

private slots:
    void statusNotifierActivated();
    /** Slot that connected to closing signal of MainWindow.
      It's responsible for cleaning mainWindow pointer. */
    void mainWindowClosed();
    /** Tooltip must be changed for new item. */
    // TODO maybe we should get Item* here instead of asking Playlist every time?
    void currentItemChanged(int newItem, int oldItem);
};

#endif
